package com.caird.pmp.iot.message.impl;

import com.caird.pmp.iot.message.MessageBase;
import io.netty.buffer.ByteBuf;
import lombok.Data;


@Data
public class ServerMessage8900 extends MessageBase {

    public ServerMessage8900() {
        id = (short)0x8900;
    }

    @Override
    public int getMaxBodyLength() {
        return 512;
    }

    @Override
    public boolean encodeBody(ByteBuf raw) {
        if (null != data && data.length() > getMaxBodyLength() - 1)
            return false;

        //透传类型
        raw.writeByte(type);

        //透传数据
        raw.writeBytes(data.getBytes());

        return true;
    }

    //透传类型
    private short type;

    //透传数据
    private String data;
}
